package maggames.games.seega;

import javax.swing.JPanel;

import maggames.core.interfaces.GameEngine;
import maggames.core.interfaces.GameFactory;

/**
 * Seega implemented GameFactory
 * 
 * @author BenjaminPLee
 * @version 1.0
 */
public class SeegaGameFactory implements GameFactory {
	private SeegaGameEngine engine = null;
	private SeegaSwingInterface swingInterface = null;

	/* (non-Javadoc)
	 * @see maggames.core.interfaces.GameFactory#getEngine()
	 */
	public SeegaGameEngine getEngine() {
		if(engine == null) {
			synchronized (this) {
				if(engine == null) {
					engine = new SeegaGameEngine();
				}
			}
		}
		
		return engine;
	}

	/* (non-Javadoc)
	 * @see maggames.core.interfaces.GameFactory#getSwingInterface()
	 */
	public SeegaSwingInterface getSwingInterface() {
		if(swingInterface == null) {
			synchronized (this) {
				if(swingInterface == null) {
					swingInterface = new SeegaSwingInterface((SeegaGameEngine)getEngine());	
				}
			}
		}
		
		return swingInterface;
	}
}
